package com.foreknow.demo12;

public class Master {
    //主要给狗看病的方法pet
    public void cure(Pet pet){
        if (pet.getHealth() < 50){
            pet.toHospital();
        }
    }

    public static void main(String[] args) {
        Master master = new Master();
        Pet p = new Dog();
        p.setHealth(40);
        master.cure(p);
        p = new Penguin();
        p.setHealth(20);
        master.cure(p);

    }
}
